package com.project.service.managerService.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.project.bean.ManagerBean;
import com.project.mapper.managerMapper.IManagerMapper;
import com.project.service.managerService.IManagerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional
public class ManagerServieImpl implements IManagerService {
    @Autowired
    private IManagerMapper managerMapper;

    @Override
    public ManagerBean login(String code, String psw) {
        return managerMapper.login(code, psw);
    }

    @Override
    public void add(ManagerBean manager) {
        managerMapper.add(manager);
    }

    @Override
    public ManagerBean findById(int id) {
        return managerMapper.findById(id);
    }

    @Override
    public PageInfo<ManagerBean> findByItem(int pageNO, String code, String state) {
        PageHelper.startPage(pageNO,PAGESIZE);
        return PageInfo.of(managerMapper.findByItem(code, state));
    }

    @Override
    public PageInfo<ManagerBean> findAll(int pageNO) {
        PageHelper.startPage(pageNO,PAGESIZE);
        return PageInfo.of(managerMapper.findAll());
    }
}
